package br.com.blog.util;

import java.io.PrintWriter;
import java.io.Serializable;
import java.io.StringWriter;

import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;

@Name("tratadorErro")
public class TratadorErro implements Serializable{
	@In("org.jboss.seam.handledException")
	private Exception excecao;
	
	public String getDetalhes() {
		StringWriter sw = new StringWriter();
		excecao.printStackTrace(new PrintWriter(sw));
		
		return sw.toString();
	}
	
	public String getMensagem() {
		return excecao.getMessage();
	}
}
